package gwt.immunology.client.activity;

import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.place.shared.Place;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import gwt.immunology.client.ClientFactory;
import gwt.immunology.client.i18n.ImmunologyI18N;
import gwt.immunology.client.place.UserPlace;
import gwt.immunology.client.view.UserView;

public class UserActivity extends AbstractActivity implements UserView.Presenter {
    private ClientFactory clientFactory;
    private ImmunologyI18N i18n = GWT.create(ImmunologyI18N.class);
//    private final UserServiceAsync userService = GWT.create(UserService.class);

    public UserActivity(UserPlace place, ClientFactory clientFactory) {
        this.clientFactory = clientFactory;
    }

    @Override
    public void start(AcceptsOneWidget panel, EventBus eventBus) {
        UserView userView = this.clientFactory.getUserView();
        userView.setPresenter(this);
        panel.setWidget(userView.asWidget());
        Window.setTitle("New Patient Registration");
    }

    @Override
    public void goTo(Place place) {
        this.clientFactory.getPlaceController().goTo(place);
    }
}
